﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace PBO.Util
{
    public static class StringHelper
    {
        public static int InRange(this int value, int min, int max)
        {
            int v = Math.Max(min, value);
            v = Math.Min(max, v);
            return v;
        }

        public static IEnumerable<T> GetLastLines<T>(this IEnumerable<T> array, int count)
        {
            int total = array.Count();
            int skip = Math.Max(0, total - count);
            return array.Skip(skip).Take(count);
        }
    }
}
